'''
curl -X POST 'https://api.coze.cn/v1/workflows/chat' \
-H "Authorization: Bearer pat_FJVQBe7ue377UWmXW7GCt7e5mX8kAghT0x06OP78fAlj2HGMCcKe5iq4ufUU7kpd" \
-H "Content-Type: application/json" \
-d '{
  "workflow_id": "7533243585509998618",
  "app_id": "7533146142726062143",
  "parameters": {
    "CONVERSATION_NAME": "Default",
    "USER_INPUT": "告诉我gpt1是什么"
  },
  "additional_messages": [
    {
      "content": "告诉我gpt1是什么",
      "content_type": "text",
      "role": "user",
      "type": "question"
    }
  ]
}'
'''


import requests


url = 'https://api.coze.cn/v1/workflows/chat'

headers = {
    'Authorization': 'Bearer pat_FJVQBe7ue377UWmXW7GCt7e5mX8kAghT0x06OP78fAlj2HGMCcKe5iq4ufUU7kpd',
    'Content-Type': 'application/json'
}

data = {
    "workflow_id": "7533243585509998618",
    "app_id": "7533146142726062143",
    "parameters": {
        "CONVERSATION_NAME": "Default",
        "USER_INPUT": "告诉我gpt1是什么"
    },
    "additional_messages": [
        {
            "content": "告诉我gpt1是什么",
            "content_type": "text",
            "role": "user",
            "type": "question"
        }
    ]
}

response = requests.post(url, headers=headers, json=data,stream=True)

for line in response.iter_lines():
    print(line.decode())


